package com.glsc.ngateway.common.base.domain.mysql.opmanage.report.subscribe;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
import com.glsc.ngateway.common.base.dto.opmanage.report.subscribe.ReportParamDto;
import org.springframework.format.annotation.DateTimeFormat;

import javax.persistence.*;
import java.math.BigInteger;
import java.time.LocalDateTime;
import java.util.List;

/**
 * @author: qiyr
 * @date: 2022/6/2 10:29
 * @description: 用户报表订阅实体类
 */
@Entity
@Table(name = "t_user_report_subscribe")
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties({"hibernateLazyInitializer", "handler"})
public class UserReportSubscribe {
    @Id
    @Column(name = "id" , columnDefinition = "bigint")
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private BigInteger id;

    @Column(name = "report_id", updatable = false)
    private String reportId;

    @Column(name = "report_name", updatable = false)
    private String reportName;

    @Column(name = "task_freq")
    private String taskFreq;

    @Column(name = "task_time")
    private String taskTime;

    @Column(name = "title_name")
    private String titleName;

    @Transient
    private String mass = "0";

    @Transient
    private String defaultAttachmentType;

    @Transient
    private String attachmentTypeStatus;

    @Column(name = "subscriber")
    private String subscriber;

    @Column(name = "username")
    private String username;

    @Column(name = "user_email")
    private String userEmail;

    @Column(name = "report_param", updatable = false)
    private String reportParam;

    @Transient
    private List<ReportParamDto> paramList;

    @Column(name = "attachment_filename")
    private String attachmentFilename;

    @Column(name = "attachment_type")
    private String attachmentType;

    @Column(name = "attachment_mode")
    private String attachmentMode;

    @Column(name = "operator")
    private String operator;

    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonSerialize(using = LocalDateTimeSerializer.class)
    @JsonDeserialize(using = LocalDateTimeDeserializer.class)
    @Column(name = "create_time", insertable = false, updatable = false)
    private LocalDateTime createTime;

    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonSerialize(using = LocalDateTimeSerializer.class)
    @JsonDeserialize(using = LocalDateTimeDeserializer.class)
    @Column(name = "update_time", insertable = false, updatable = false)
    private LocalDateTime updateTime;

    public UserReportSubscribe() {
    }

    public UserReportSubscribe(BigInteger id, String reportId, String reportName, String taskFreq,
                               String taskTime, String titleName, String subscriber, String username,
                               String userEmail, String reportParam, String attachmentFilename,
                               String attachmentType, String attachmentMode, String operator,
                               LocalDateTime createTime, LocalDateTime updateTime) {
        this.id = id;
        this.reportId = reportId;
        this.reportName = reportName;
        this.taskFreq = taskFreq;
        this.taskTime = taskTime;
        this.titleName = titleName;
        this.subscriber = subscriber;
        this.username = username;
        this.userEmail = userEmail;
        this.reportParam = reportParam;
        this.attachmentFilename = attachmentFilename;
        this.attachmentType = attachmentType;
        this.attachmentMode = attachmentMode;
        this.operator = operator;
        this.createTime = createTime;
        this.updateTime = updateTime;
    }

    public BigInteger getId() {
        return id;
    }

    public void setId(BigInteger id) {
        this.id = id;
    }

    public String getReportId() {
        return reportId;
    }

    public void setReportId(String reportId) {
        this.reportId = reportId;
    }

    public String getReportName() {
        return reportName;
    }

    public void setReportName(String reportName) {
        this.reportName = reportName;
    }

    public String getTaskFreq() {
        return taskFreq;
    }

    public void setTaskFreq(String taskFreq) {
        this.taskFreq = taskFreq;
    }

    public String getTaskTime() {
        return taskTime;
    }

    public void setTaskTime(String taskTime) {
        this.taskTime = taskTime;
    }

    public String getTitleName() {
        return titleName;
    }

    public void setTitleName(String titleName) {
        this.titleName = titleName;
    }

    public String getMass() {
        return mass;
    }

    public void setMass(String mass) {
        this.mass = mass;
    }

    public String getDefaultAttachmentType() {
        return defaultAttachmentType;
    }

    public void setDefaultAttachmentType(String defaultAttachmentType) {
        this.defaultAttachmentType = defaultAttachmentType;
    }

    public String getAttachmentTypeStatus() {
        return attachmentTypeStatus;
    }

    public void setAttachmentTypeStatus(String attachmentTypeStatus) {
        this.attachmentTypeStatus = attachmentTypeStatus;
    }

    public String getSubscriber() {
        return subscriber;
    }

    public void setSubscriber(String subscriber) {
        this.subscriber = subscriber;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getUserEmail() {
        return userEmail;
    }

    public void setUserEmail(String userEmail) {
        this.userEmail = userEmail;
    }

    public String getReportParam() {
        return reportParam;
    }

    public void setReportParam(String reportParam) {
        this.reportParam = reportParam;
    }

    public List<ReportParamDto> getParamList() {
        return paramList;
    }

    public void setParamList(List<ReportParamDto> paramList) {
        this.paramList = paramList;
    }

    public String getAttachmentFilename() {
        return attachmentFilename;
    }

    public void setAttachmentFilename(String attachmentFilename) {
        this.attachmentFilename = attachmentFilename;
    }

    public String getAttachmentType() {
        return attachmentType;
    }

    public void setAttachmentType(String attachmentType) {
        this.attachmentType = attachmentType;
    }

    public String getAttachmentMode() {
        return attachmentMode;
    }

    public void setAttachmentMode(String attachmentMode) {
        this.attachmentMode = attachmentMode;
    }

    public String getOperator() {
        return operator;
    }

    public void setOperator(String operator) {
        this.operator = operator;
    }

    public LocalDateTime getCreateTime() {
        return createTime;
    }

    public void setCreateTime(LocalDateTime createTime) {
        this.createTime = createTime;
    }

    public LocalDateTime getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(LocalDateTime updateTime) {
        this.updateTime = updateTime;
    }
}
